home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir30 / eerems11.zip / EER_MAIN.C < prev    next >
C/C++ Source or Header  |  1994-10-23  |  3KB  |  114 lines

  1. /* ***************************************************************
  2.  
  3. An AutoCAD ADS program to remove "extra entities"
  4.  
  5. This module contains the main routine and the global variables
  6. used by multiple modules
  7.  
  8. Jon Fleming    CIS 70334,2443    July 19, 1994
  9.  
  10. Public Domain; Please give me credit if you use this or any
  11. significant portion of it
  12.  
  13. Revision history:
  14.  
  15. July 19, 1994  Version 1.0: Initial release
  16.  
  17. October 23, 1994 Version 1.1: Modified EER_CORE.C to handle negative line
  18.     endpoints properly, and to avoid checking for entities to remove when
  19.     no entities were selected in the "candidates for removal" selection set.
  20.     Modified EER_CORE.C and EEREM.H to include version number report when
  21.     DoEntityRemoval starts.
  22.  
  23. *********************************************************** */
  24.  
  25. #include  <stdio.h>
  26. #include  "adslib.h"
  27. #include "eerem.h"
  28.  
  29. extern int eerem ();
  30. extern int ddeerem ();
  31.  
  32. /* Indicators for whether to consider layer, linetype, and/or color */
  33.  
  34. int CheckLayer = FALSE, CheckLType = FALSE, CheckColor = FALSE;
  35.  
  36. /* Tolerance within which numbers are considered equal (at least, that's
  37.    approximately what this is; see the documentation and core module for
  38.    more detail)  */
  39.  
  40. ads_real Tolerance = 0.00001;
  41.  
  42.  
  43. /* The constant 2*pi */
  44.  
  45. ads_real TwoPi;
  46.  
  47. void main(argc, argv)
  48.   int argc;
  49.   char *argv[];
  50. {
  51.    int stat;
  52.    short scode = RSRSLT;             /* This is the default result code */
  53.  
  54.  
  55.    ads_init(argc, argv);             /* Initialize the interface */
  56.  
  57.  
  58.    for ( ;; ) {
  59.  
  60.       if ((stat = ads_link(scode)) < 0) {
  61.          /* Can't use ads_printf to display 
  62.             this message, because the link failed */
  63.          printf("O-PROJ: bad status from ads_link() = %d\n", stat);
  64.          fflush(stdout);
  65.          exit(1);
  66.       }
  67.  
  68.          scode = RSRSLT;               /* Default return value */
  69.  
  70.          switch (stat) {
  71.  
  72.             case RQXLOAD:              /* Define our functions to AutoLISP
  73.                                           and ADS */
  74.  
  75.                scode = ads_defun("eerem", 0) ? RSRSLT : RSERR;
  76.  
  77.                if (scode != RSERR)
  78.                   scode = ads_regfunc (eerem, 0) ? RSRSLT : RSERR;
  79.  
  80.                if (scode != RSERR)
  81.                   scode = ads_defun("ddeerem", 1) ? RSRSLT : RSERR;
  82.  
  83.                if (scode != RSERR)
  84.                   scode = ads_regfunc (ddeerem, 0) ? RSRSLT : RSERR;
  85.  
  86.                if (scode != RSERR)
  87.                   scode = ads_defun("C:ddeerem", 2) ? RSRSLT : RSERR;
  88.  
  89.                break;
  90.  
  91.             case RQSUBR:               /* Execute a function */
  92.  
  93.                switch (ads_getfuncode()) {
  94.                   case 0:
  95.                      /* Non-dialog version called from ADS or AutoLISP */
  96.                      eerem();
  97.                      break;
  98.                   case 1:
  99.                      /* Dialog box version called from ADS or AutoLISP */
  100.                      ddeerem();
  101.                      break;
  102.                   case 2:
  103.                      /* Dialog box version called from command line */
  104.                      ddeerem();
  105.                      break;
  106.                }
  107.                break;
  108.  
  109.             default:
  110.                break;
  111.             }
  112.       }
  113. }
  114.